{include file="public/header" /}
<title></title>
</head>

<body>
	<article class="page-container">
		<form class="form form-horizontal" id="form-admin-add" method="post">
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>类别：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<select class="select" name="pid" id="pid" size="1">
						<option value="1">用户手机端</option>
						<option value="2">商家电脑端</option>
						<option value="3">收银员电脑端</option>
						<option value="4">收银员APP端</option>
						<option value="5">OEM电脑端</option>
						<option value="6">省市代电脑端</option>
					</select>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>标题：</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" value="" placeholder="" id="title" name="title">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>内容：</label>
				<div id="div1" class="toolbar" style="background-color: #d4cece;">
			    </div>
			    <div id="div2" class="text" style="float: right; height: 450px;background-color: #f7f7f7;width: 750px;" >
			    </div>
			    <textarea name="content" id="content" style="display: none;"></textarea>
			</div>
			<div class="row cl">
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
					<input class="btn btn-primary radius" id='tijiao' type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
				</div>
			</div>
		</form>
	</article>
{include file="public/footer" /}
<script type="text/javascript" src="__PUBLIC__/static/release/wangEditor.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/static/js/assist.js"></script>
<script type="text/javascript">
        var E = window.wangEditor
        var editor1 = new E('#div1', '#div2')
        editor1.customConfig.uploadImgServer="wang_upload"; 
	    editor1.customConfig.uploadImgHooks = {
	    	customInsert: function (insertImg, result, editor) {
	        var url = result.src;
	        insertImg(url)
	    	}
	    }
        editor1.create();
</script>
<script type="text/javascript">
		$(function() {
			$('.skin-minimal input').iCheck({
				checkboxClass: 'icheckbox-blue',
				radioClass: 'iradio-blue',
				increaseArea: '20%'
			});

			$('#tijiao').click(function() {
				$('#content').val(editor1.txt.html());
				
				$.ajax({
					type: 'post',
					data: {
						pid: $('#pid option:selected').val(),
						title: $('#title').val(),
						content: $('#content').val()
					},
					url: "{:url('sys/helps_add')}",
					success: function(data) {
						if(data.code == 200) {
							layer.msg(data.msg, {
								icon: 1,
								time: 1000
							}, function() {
								window.parent.location.reload();
								var index = parent.layer.getFrameIndex(window.name);
								parent.layer.close(index);
							});
						} else {
							layer.msg(data.msg, {
								icon: 1,
								time: 1000
							});
						}

					},
					error: function(XmlHttpRequest, textStatus, errorThrown) {
						layer.msg(data.msg, {
							icon: 1,
							time: 1000
						});
					}
				});
			});
		});
	</script>